<template>
  <div class="titlebtn"
       v-bind:style="style"
       v-on:click="click()" />
</template>

<script>
const { ipcRenderer: ipc } = require('electron')
const style = {
  min: {
    backgroundColor: 'green',
    right: '100px'
  },
  max: {
    backgroundColor: 'yellow',
    right: '60px'
  },
  close: {
    backgroundColor: 'red',
    right: '20px'
  }
}
export default {
  name: 'Titlebtn',
  props: ['type'],
  computed: {
    style: function () {
      return style[this.type]
    }
  },
  methods: {
    click: function () {
      console.log('type--->' + this.type)
      ipc.send(this.type)
    }
  }
}
</script>
    
<style>
.titlebtn {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 10px;
  top: 0;
  bottom: 0;
  margin: auto 0;
  -webkit-app-region: no-drag;
}
</style>